-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add support for emitting Mach-O R2R images #121186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…PE writer, don't do that for other formats where we don't have the PE Optional Header.
… little different).
…y only one valid way to write the symbol range
179146b to
9a08c72
Compare
|
/azp run runtime-ioslike |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-ioslike |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
/azp run runtime-ioslike |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-ioslike |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-ioslike |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-ioslike |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
|
||
| <MakeDir Directories="$([System.IO.Path]::GetDirectoryName(%(_ReadyToRunNativeObjectOutputs.Identity)))" /> | ||
|
|
||
| <Exec Command=""$(_AppleClang)" @(_MachLinkerArg, ' ')" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since -ld_classic results in a warning on Xcode 16+, I think we need to do something like:
| IgnoreStandardErrorWarningFormat="$(_IgnoreLinkerWarnings)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this still needs to be addressed. Also in crossgen-corelib.
|
I pulled this down to check out the generated System.Private.CoreLib.dylib built on a mac - targeted osx and ios. |
elinor-fung
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the comment about the linker warnings, looks good to me.
| </Target> | ||
|
|
||
| <Target | ||
| Name="LinkCoreLibMachO" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reuse SetupOSSpecificProps target instead of duplication?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's difficult to reuse the NativeAOT targets here and we only need a stripped-down version of them, so it's easier to duplicate (especially as we the design for exactly how we want to produce the Mach-O files may change).
…n flow this back to the sdk repo)
…nsion in the macho scenario
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally for macos (osx, not mobile) with the runtime/host changes. With the fix for the flipped *_RELOC_SUBTRACTOR/*_RELOC_UNSIGNED index, I can successfully run a runtime test using the Mach-O R2R SPCL and a Mach-O R2R image for the test assembly itself.
| new MachRelocation | ||
| { | ||
| Address = (int)symbolicRelocation.Offset, | ||
| SymbolOrSectionIndex = startSymbolIndex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| SymbolOrSectionIndex = startSymbolIndex, | |
| SymbolOrSectionIndex = endSymbolIndex, |
| new MachRelocation | ||
| { | ||
| Address = (int)symbolicRelocation.Offset, | ||
| SymbolOrSectionIndex = endSymbolIndex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| SymbolOrSectionIndex = endSymbolIndex, | |
| SymbolOrSectionIndex = startSymbolIndex, |
| new MachRelocation | ||
| { | ||
| Address = (int)symbolicRelocation.Offset, | ||
| SymbolOrSectionIndex = (uint)symbolIndex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| SymbolOrSectionIndex = (uint)symbolIndex, | |
| SymbolOrSectionIndex = _symbolNameToIndex[_baseSymbolName], |
| new MachRelocation | ||
| { | ||
| Address = (int)symbolicRelocation.Offset, | ||
| SymbolOrSectionIndex = _symbolNameToIndex[_baseSymbolName], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| SymbolOrSectionIndex = _symbolNameToIndex[_baseSymbolName], | |
| SymbolOrSectionIndex = (uint)symbolIndex, |
| new MachRelocation | ||
| { | ||
| Address = (int)symbolicRelocation.Offset, | ||
| SymbolOrSectionIndex = startSymbolIndex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| SymbolOrSectionIndex = startSymbolIndex, | |
| SymbolOrSectionIndex = endSymbolIndex, |
| new MachRelocation | ||
| { | ||
| Address = (int)symbolicRelocation.Offset, | ||
| SymbolOrSectionIndex = endSymbolIndex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| SymbolOrSectionIndex = endSymbolIndex, | |
| SymbolOrSectionIndex = startSymbolIndex, |
| new MachRelocation | ||
| { | ||
| Address = (int)symbolicRelocation.Offset, | ||
| SymbolOrSectionIndex = (uint)symbolIndex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| SymbolOrSectionIndex = (uint)symbolIndex, | |
| SymbolOrSectionIndex = _symbolNameToIndex[_baseSymbolName], |
| new MachRelocation | ||
| { | ||
| Address = (int)symbolicRelocation.Offset, | ||
| SymbolOrSectionIndex = _symbolNameToIndex[_baseSymbolName], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Symbols are flipped - the pair represents <unsigned_symbol> - <subtractor_symbol>, so ARM64_RELOC_SUBTRACTOR should be the base.
| SymbolOrSectionIndex = _symbolNameToIndex[_baseSymbolName], | |
| SymbolOrSectionIndex = (uint)symbolIndex, |
…composite R2R images (#121363) Add the basic runtime flow for calling into the host to get information about a platform-native R2R - see docs/design/coreclr/botr/readytorun-platform-native-envelope.md#runtime-consuming-a-platform-native-r2r-image. - Add `get_native_code_data` callback to `host_runtime_contract` - If a component R2R assembly has `READYTORUN_FLAG_PLATFORM_NATIVE_IMAGE`, invoke the callback to get the R2R header, image size, and image base address - Currently only implemented and tested on Windows (with local changes to include the flag) - Mach-O support will need #121186 Contributes to #120065.
Adds support in crossgen2 for emitting Mach-O objects.
Does not yet do the runtime support as that depends on #120777